package client;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class ListPanel extends JPanel{
	
	public ListPanel(String cath, String criteria, Object[] o){
		super(new BorderLayout());
		JPanel north = new JPanel(new GridLayout(2,1));
		north.add(new JLabel(cath));
		north.add(new JLabel(criteria));
		add(north, BorderLayout.NORTH);
		add(new JScrollPane(new ListGui(o)), BorderLayout.CENTER);
		JButton addItem = new JButton("Add item");
		add(addItem, BorderLayout.SOUTH);
	}
	
	private class ListGui extends JPanel{
		
		public ListGui(Object[] all){
			setLayout(new GridLayout(all.length, 1));
			for(int i = 0;i<all.length;i++){
				add(new JLabel(i+" "+all.toString()));
			}
		}
		
	}
	

}
